draw the indicator if the column has a sort column id (and the model is
authorKristian Rietveld <kris@gtk.org>
Sun, 24 Sep 2006 17:03:45 +0000 (17:03 +0000)
committerKristian Rietveld <kristian@src.gnome.org>
Sun, 24 Sep 2006 17:03:45 +0000 (17:03 +0000)
2006-09-24  Kristian Rietveld  <kris@gtk.org>

* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button): draw
the indicator if the column has a sort column id (and the model is
sortable) or if the user explicitly requested the indicator
to be shown.  (Fixes #352738, Chris Vine).

ChangeLog
gtk/gtktreeviewcolumn.c

index 37ca524fe67a25aa0148aca2cbe25218b808a586..eb8f0dd3d5d5fe67feca07514cac57a6fa7429ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-09-24  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button): draw
+       the indicator if the column has a sort column id (and the model is
+       sortable) or if the user explicitly requested the indicator
+       to be shown.  (Fixes #352738, Chris Vine).
+
 2006-09-23  Tor Lillqvist  <tml@novell.com>
 
        * gtk/Makefile.am: Use EXEEXT.
index 3ee3fcc47513efbbcdc6919e2d9771964c9f24ad..b529db54a1a0a76553685c93a92af1fe5d0bcfef 100644 (file)
@@ -843,7 +843,7 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
 static void 
 gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
 {
-  gint sort_column_id;
+  gint sort_column_id = -1;
   GtkWidget *hbox;
   GtkWidget *alignment;
   GtkWidget *arrow;
@@ -905,27 +905,27 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
                                          "");
     }
 
-  if (GTK_IS_TREE_SORTABLE (model)
-      && gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model),
-                                              &sort_column_id,
-                                              NULL))
+  if (GTK_IS_TREE_SORTABLE (model))
+    gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model),
+                                         &sort_column_id,
+                                         NULL);
+
+  if (tree_column->show_sort_indicator
+      || (sort_column_id >= 0 && sort_column_id == tree_column->sort_column_id))
     {
-      if (sort_column_id == tree_column->sort_column_id)
-       {
-         switch (tree_column->sort_order)
-           {
-             case GTK_SORT_ASCENDING:
-               arrow_type = GTK_ARROW_DOWN;
-               break;
+      switch (tree_column->sort_order)
+        {
+         case GTK_SORT_ASCENDING:
+           arrow_type = GTK_ARROW_DOWN;
+           break;
 
-             case GTK_SORT_DESCENDING:
-               arrow_type = GTK_ARROW_UP;
-               break;
-          
-             default:
-               g_warning (G_STRLOC": bad sort order");
-               break;
-           }
+         case GTK_SORT_DESCENDING:
+           arrow_type = GTK_ARROW_UP;
+           break;
+
+         default:
+           g_warning (G_STRLOC": bad sort order");
+           break;
        }
     }
 
@@ -952,7 +952,8 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
     }
   g_object_unref (arrow);
 
-  if (GTK_IS_TREE_SORTABLE (model) && tree_column->sort_column_id >= 0)
+  if (tree_column->show_sort_indicator
+      || (GTK_IS_TREE_SORTABLE (model) && tree_column->sort_column_id >= 0))
     gtk_widget_show (arrow);
   else
     gtk_widget_hide (arrow);